package ExamSystemClient.model;

import java.io.Serializable;

/**
 * 选择题的选项
 *
 * @author Shuxian Huang
 */
public class Option implements Serializable {

    /**
     * 选项编号枚举
     */
    public enum OptionCode{
        OPTION_A("A"),
        OPTION_B("B"),
        OPTION_C("C"),
        OPTION_D("D");

        public String str;

        OptionCode(String str){
            this.str = str;
        }

        public static OptionCode parse(String str){
            if (str.equals("A")){
                return OPTION_A;
            }
            if (str.equals("B")){
                return OPTION_B;
            }
            if (str.equals("C")){
                return OPTION_C;
            }
            if (str.equals("D")){
                return OPTION_D;
            }
            return null;
        }
    }

    private OptionCode optionCode;

    private String value;

    public Option() {
    }

    public Option(OptionCode optionCode, String value) {
        this.optionCode = optionCode;
        this.value = value;
    }

    public OptionCode getOptionCode() {
        return optionCode;
    }

    public void setOptionCode(OptionCode optionCode) {
        this.optionCode = optionCode;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return optionCode.str + ":" + value;
    }
}
